home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 135 (1990-05-15)(Ossowski, Stefan)(DE)(PD)[v Disaster Master 2].zip / Taifun 135 (1990-05-15)(Ossowski, Stefan)(DE)(PD)[v Disaster Master 2].adf / MiscUtils / rgb.c < prev    next >
C/C++ Source or Header  |  1990-02-23  |  2KB  |  67 lines

  1. /*======================================================*/
  2. /*                                                                                                            */
  3. /* Cli command to set the rgb values of a color        V1.0    */
  4. /* This utility changes the rgb values of the front            */
  5. /* screen                                                                                                */
  6. /*                                                                                                            */
  7. /* © J.Tyberghein   6 sep 89     V1.0                                            */
  8. /*        Tue Dec 19 15:42:36 1989                                                    */
  9. /*                                                                                                            */
  10. /* Compile with:                                                                                */
  11. /*        Lattice 5.0x:                                                                            */
  12. /*            lc -v -cms -L -O rgb                                                        */
  13. /*        Aztec 3.6:                                                                                */
  14. /*            cc rgb.c                                                                                */
  15. /*            ln +q rgb.o -lc                                                                    */
  16. /*                                                                                                            */
  17. /*======================================================*/
  18.  
  19.  
  20. #include <exec/types.h>
  21. #include <graphics/gfxbase.h>
  22. #include <intuition/intuitionbase.h>
  23.  
  24. #ifdef LATTICE
  25. #include <proto/graphics.h>
  26. #include <proto/exec.h>
  27. #endif
  28. #ifndef LATTICE
  29. #include <functions.h>
  30. #endif
  31.  
  32.  
  33. struct IntuitionBase *IntuitionBase;
  34. struct GfxBase *GfxBase;
  35.  
  36.  
  37. void main (argc,argv)
  38. int argc;
  39. char *argv[];
  40. {
  41.     LONG cn,r,g,b;
  42.  
  43.     if (argc != 5)
  44.         {
  45.             printf ("Usage: <color> <red> <green> <blue>\n");
  46.             exit (0);
  47.         }
  48.     if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary ("intuition.library",0L)))
  49.         {
  50.             printf ("Error opening Intuition !\n");
  51.             exit (1);
  52.         }
  53.     if (!(GfxBase=(struct GfxBase *)OpenLibrary ("graphics.library",0L)))
  54.         {
  55.             CloseLibrary ((struct Library *)IntuitionBase);
  56.             printf ("Error opening graphics !\n");
  57.             exit (1);
  58.         }
  59.     sscanf (argv[1],"%ld",&cn);
  60.     sscanf (argv[2],"%ld",&r);
  61.     sscanf (argv[3],"%ld",&g);
  62.     sscanf (argv[4],"%ld",&b);
  63.     SetRGB4 (&(IntuitionBase->FirstScreen->ViewPort),cn%32L,r%16L,g%16L,b%16L);
  64.     CloseLibrary ((struct Library *)IntuitionBase);
  65.     CloseLibrary ((struct Library *)GfxBase);
  66. }
  67.